#!/usr/bin/env python3

"""这是一个计算圆周率的级数算法
"""

s =0 
for i in range(1, 1000000):
    if i % 2 ==0:
        s -= 1/(2*i-1)  # s = s - 1/(2*i-1)
    else:
        s += 1/(2*i-1)
s *= 4
print('pi = %f' % s)

"""打印乘法口诀表
"""
for i in range(1, 10):
    for j in range(1, i+1):
        print('%d X %d = %d' % (j, i, i*j), end=' ')
    print()
